package com.bjpowernode.controller;

import com.bjpowernode.vo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName MyController
 * @Description 当@RequestMapping中有公共的部分时，可以将公共部分放到类的上边
 * @Author hhwu
 * @Date 2022/3/10 13:04
 * Version 1.0
 **/

@Controller//创建处理器对象，和@Service,@Component一样
@RequestMapping("/user")//当方法上的@RequestMapping中有公共的部分时，可以将公共部分抽取放到类的上边，更加方便易辨别
public class MyController {
    @RequestMapping(value = {"/some.do"})//不指定请求方式时没有限制
    public ModelAndView doSome(String name, Integer age) {
        System.out.println("doSome name = "+name+"age = "+age);
        ModelAndView mv = new ModelAndView();
        mv.addObject("myname", name);
        mv.addObject("myage", age);
        mv.setViewName("show");
        return mv;
    }
}
